﻿namespace PMS.Client.FrmUserRegist
{
    using PMS.BLL;
    using PMS.Client.Controls;
    using PMS.Client.Properties;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FrmUserRegistLogList : Form
    {
        private ToolStripButton btnCheck;
        private ToolStripButton btnDelete;
        private IContainer components = null;
        private UCDataGridView dataGridView1;
        private DataGridViewTextBoxColumn IsHeighWith;
        private DataGridViewTextBoxColumn IUserName;
        private Label lbTitle;
        private UserChangeLogBLL logbll = new UserChangeLogBLL();
        private DataGridViewTextBoxColumn LogID;
        private DataGridViewTextBoxColumn LogType;
        private DataGridViewTextBoxColumn RegistDate;
        private DataGridViewTextBoxColumn RegistDay;
        private DataGridViewTextBoxColumn RegistFrom;
        private DataGridViewTextBoxColumn RegistNo;
        private DataGridViewTextBoxColumn RegistRemark;
        private DataGridViewTextBoxColumn RegistState;
        private DataGridViewTextBoxColumn RegistSummary;
        private DataGridViewTextBoxColumn RegistTo;
        private DataGridViewTextBoxColumn RegistType;
        private DataGridViewTextBoxColumn RegistWay;
        private ToolStrip toolStrip1;

        public FrmUserRegistLogList()
        {
            this.InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
            this.DataGridbind();
        }

        private void btnCheck_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请选择要审核的行！");
            }
            else
            {
                FrmUserRegistLogCheck check = new FrmUserRegistLogCheck(int.Parse(this.dataGridView1.SelectedRows[0].Cells["LogID"].Value.ToString()));
                check.ShowDialog();
                if (check.DialogResult == DialogResult.OK)
                {
                    this.DataGridbind();
                }
            }
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count < 0)
            {
                MessageBox.Show("请选择要删除的行！");
            }
            else if (MessageBox.Show("确定删除？", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
            {
                int logID = int.Parse(this.dataGridView1.SelectedRows[0].Cells["LogID"].Value.ToString());
                if (this.logbll.Delete(logID))
                {
                    this.DataGridbind();
                }
                else
                {
                    MessageBox.Show("删除失败！");
                }
            }
        }

        private void DataGridbind()
        {
            this.dataGridView1.DataSource = this.logbll.GetList(" AND LogType='入编'");
        }

        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex == 9)
            {
                if (e.Value.ToString() == "1")
                {
                    e.Value = "是";
                }
                else
                {
                    e.Value = "否";
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FrmBaseInfoLogList_FormClosing(object sender, FormClosingEventArgs e)
        {
            base.DialogResult = DialogResult.OK;
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(FrmUserRegistLogList));
            this.dataGridView1 = new UCDataGridView(this.components);
            this.toolStrip1 = new ToolStrip();
            this.btnCheck = new ToolStripButton();
            this.btnDelete = new ToolStripButton();
            this.lbTitle = new Label();
            this.LogID = new DataGridViewTextBoxColumn();
            this.IUserName = new DataGridViewTextBoxColumn();
            this.LogType = new DataGridViewTextBoxColumn();
            this.RegistFrom = new DataGridViewTextBoxColumn();
            this.RegistTo = new DataGridViewTextBoxColumn();
            this.RegistType = new DataGridViewTextBoxColumn();
            this.RegistDay = new DataGridViewTextBoxColumn();
            this.RegistWay = new DataGridViewTextBoxColumn();
            this.RegistState = new DataGridViewTextBoxColumn();
            this.IsHeighWith = new DataGridViewTextBoxColumn();
            this.RegistNo = new DataGridViewTextBoxColumn();
            this.RegistDate = new DataGridViewTextBoxColumn();
            this.RegistSummary = new DataGridViewTextBoxColumn();
            this.RegistRemark = new DataGridViewTextBoxColumn();
            ((ISupportInitialize) this.dataGridView1).BeginInit();
            this.toolStrip1.SuspendLayout();
            base.SuspendLayout();
            this.dataGridView1.AllowUserToAddRows = false;
            this.dataGridView1.AllowUserToDeleteRows = false;
            this.dataGridView1.AllowUserToResizeRows = false;
            this.dataGridView1.BackgroundColor = Color.FromArgb(0xa4, 0xc4, 0xeb);
            this.dataGridView1.BorderStyle = BorderStyle.None;
            this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            this.dataGridView1.Columns.AddRange(new DataGridViewColumn[] { this.LogID, this.IUserName, this.LogType, this.RegistFrom, this.RegistTo, this.RegistType, this.RegistDay, this.RegistWay, this.RegistState, this.IsHeighWith, this.RegistNo, this.RegistDate, this.RegistSummary, this.RegistRemark });
            style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            style.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            style.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style.ForeColor = SystemColors.ControlText;
            style.SelectionBackColor = SystemColors.Highlight;
            style.SelectionForeColor = SystemColors.ControlText;
            style.WrapMode = DataGridViewTriState.False;
            this.dataGridView1.DefaultCellStyle = style;
            this.dataGridView1.Dock = DockStyle.Fill;
            this.dataGridView1.EnableHeadersVisualStyles = false;
            this.dataGridView1.GridColor = Color.FromArgb(0xd0, 0xd7, 0xe5);
            this.dataGridView1.HighlightSelectedColumnHeaders = false;
            this.dataGridView1.Location = new Point(0, 0x57);
            this.dataGridView1.MultiSelect = false;
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.ReadOnly = true;
            this.dataGridView1.RowTemplate.Height = 0x17;
            this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            this.dataGridView1.Size = new Size(0x406, 0x18c);
            this.dataGridView1.TabIndex = 13;
            this.dataGridView1.CellFormatting += new DataGridViewCellFormattingEventHandler(this.dataGridView1_CellFormatting);
            this.toolStrip1.Items.AddRange(new ToolStripItem[] { this.btnCheck, this.btnDelete });
            this.toolStrip1.Location = new Point(0, 0x1f);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.RenderMode = ToolStripRenderMode.System;
            this.toolStrip1.Size = new Size(0x406, 0x38);
            this.toolStrip1.TabIndex = 15;
            this.toolStrip1.Text = "toolStrip1";
            this.btnCheck.Image = Resources.check;
            this.btnCheck.ImageScaling = ToolStripItemImageScaling.None;
            this.btnCheck.ImageTransparentColor = Color.Magenta;
            this.btnCheck.Name = "btnCheck";
            this.btnCheck.Size = new Size(0x24, 0x35);
            this.btnCheck.Text = "审批";
            this.btnCheck.TextImageRelation = TextImageRelation.ImageAboveText;
            this.btnCheck.Click += new EventHandler(this.btnCheck_Click);
            this.btnDelete.Image = Resources.delete;
            this.btnDelete.ImageScaling = ToolStripItemImageScaling.None;
            this.btnDelete.ImageTransparentColor = Color.Magenta;
            this.btnDelete.Name = "btnDelete";
            this.btnDelete.Size = new Size(0x24, 0x35);
            this.btnDelete.Text = "删除";
            this.btnDelete.TextImageRelation = TextImageRelation.ImageAboveText;
            this.btnDelete.Click += new EventHandler(this.btnDelete_Click);
            this.lbTitle.BackColor = Color.Gold;
            this.lbTitle.Dock = DockStyle.Top;
            this.lbTitle.Font = new Font("宋体", 14.25f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.lbTitle.ForeColor = Color.Black;
            this.lbTitle.Location = new Point(0, 0);
            this.lbTitle.Name = "lbTitle";
            this.lbTitle.Size = new Size(0x406, 0x1f);
            this.lbTitle.TabIndex = 0x10;
            this.lbTitle.Text = "人员编制信息审核";
            this.lbTitle.TextAlign = ContentAlignment.MiddleCenter;
            this.LogID.DataPropertyName = "LogID";
            this.LogID.HeaderText = "ID";
            this.LogID.Name = "LogID";
            this.LogID.ReadOnly = true;
            this.LogID.Visible = false;
            this.LogID.Width = 50;
            this.IUserName.DataPropertyName = "IUserName";
            this.IUserName.HeaderText = "姓名";
            this.IUserName.Name = "IUserName";
            this.IUserName.ReadOnly = true;
            this.LogType.DataPropertyName = "LogType";
            this.LogType.HeaderText = "日志类型";
            this.LogType.Name = "LogType";
            this.LogType.ReadOnly = true;
            this.RegistFrom.DataPropertyName = "RegistFrom";
            this.RegistFrom.HeaderText = "入编来源";
            this.RegistFrom.Name = "RegistFrom";
            this.RegistFrom.ReadOnly = true;
            this.RegistTo.DataPropertyName = "RegistTo";
            this.RegistTo.HeaderText = "现编单位";
            this.RegistTo.Name = "RegistTo";
            this.RegistTo.ReadOnly = true;
            this.RegistType.DataPropertyName = "RegistType";
            this.RegistType.HeaderText = "编制类别";
            this.RegistType.Name = "RegistType";
            this.RegistType.ReadOnly = true;
            this.RegistDay.DataPropertyName = "RegistDay";
            this.RegistDay.HeaderText = "入编登记时间";
            this.RegistDay.Name = "RegistDay";
            this.RegistDay.ReadOnly = true;
            this.RegistDay.Width = 120;
            this.RegistWay.DataPropertyName = "RegistWay";
            this.RegistWay.HeaderText = "入编形式";
            this.RegistWay.Name = "RegistWay";
            this.RegistWay.ReadOnly = true;
            this.RegistWay.Width = 120;
            this.RegistState.DataPropertyName = "RegistState";
            this.RegistState.HeaderText = "在编状态";
            this.RegistState.Name = "RegistState";
            this.RegistState.ReadOnly = true;
            this.IsHeighWith.DataPropertyName = "IsHeighWith";
            this.IsHeighWith.HeaderText = "是否高配";
            this.IsHeighWith.Name = "IsHeighWith";
            this.IsHeighWith.ReadOnly = true;
            this.RegistNo.DataPropertyName = "RegistNo";
            this.RegistNo.HeaderText = "控编文号";
            this.RegistNo.Name = "RegistNo";
            this.RegistNo.ReadOnly = true;
            this.RegistDate.DataPropertyName = "RegistDate";
            this.RegistDate.HeaderText = "下文时间";
            this.RegistDate.Name = "RegistDate";
            this.RegistDate.ReadOnly = true;
            this.RegistDate.Width = 120;
            this.RegistSummary.DataPropertyName = "RegistSummary";
            this.RegistSummary.HeaderText = "摘要";
            this.RegistSummary.Name = "RegistSummary";
            this.RegistSummary.ReadOnly = true;
            this.RegistRemark.DataPropertyName = "RegistRemark";
            this.RegistRemark.HeaderText = "备注";
            this.RegistRemark.Name = "RegistRemark";
            this.RegistRemark.ReadOnly = true;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x406, 0x1e3);
            base.Controls.Add(this.dataGridView1);
            base.Controls.Add(this.toolStrip1);
            base.Controls.Add(this.lbTitle);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.Name = "FrmUserRegistLogList";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "人员入编审核";
            base.FormClosing += new FormClosingEventHandler(this.FrmBaseInfoLogList_FormClosing);
            ((ISupportInitialize) this.dataGridView1).EndInit();
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

